<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>登陆</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<!-- 引入 Bootstrap -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/css/bootstrap.css" />
<link rel="stylesheet" href="/css/index.css" />
</head>

<body>
	<div class="row">
		<div class="col-md-12">
			<div class="page-header">
				<h1>登录</h1>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-4"></div>
		<div class="col-md-4">
			<div style="padding: 50px;">
				<form th:action="@{/manage/main/login}"
					class="bs-example bs-example-form" role="form">
					<div class="input-group input-group-lg">
						<span class="input-group-addon" id="sizing-addon1">@</span> <input
							type="text" class="form-control" placeholder="用户名"
							name="username" maxlength="20" id="ipt_username"
							aria-describedby="sizing-addon1">
					</div>
					<div class="input-group input-group-lg">
						<span class="input-group-addon" id="sizing-addon1">@</span> <input
							type="password" class="form-control" placeholder="密码"
							name="password" maxlength="20" id="ipt_password"
							aria-describedby="sizing-addon1">
					</div>

					<button type="button" class="btn btn-default navbar-btn"
						style="width: 100%; height: 40px; margin-top: 10px;"
						onclick="login()">登录</button>
				</form>
			</div>
		</div>
		<div class="col-md-4"></div>
	</div>
	<script type="text/javascript" src="/js/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/js/jquery.md5.js"></script>
	<script type="text/javascript">
		function login() {
			var username = $("#ipt_username").val();
			var password = $("#ipt_password").val();
			if (username.trim().length == 0) {
				alert("请填写用户名");
				return false;
			}
			if (password.trim().length == 0) {
				alert("请填写密码");
				return false;
			}
			password = $.md5(password);
			var postData = {};
			postData.username = username;
			postData.password = password;
			$.post("", postData, function(result) {
				if (result.code == 200) {
					location.href = "/manage/server/list";
				} else {
					alert(result.mes);
				}

			})
		}
	</script>
</body>

</html>